﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Areas/Admin/Views/Shared/AdminMaster.Master" Inherits="System.Web.Mvc.ViewPage<VietThuongLMS.Areas.Admin.Models.ChuongTrinhKhuyenMaiModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
</br>
<div class="widget blue">
    <div class="widget-title">
        <h4><i class="icon-reorder"></i>&nbsp;Sửa chương trình khuyến mãi</h4>
    </div>                      
    <div class="widget-body">

    <% using (Html.BeginForm("Update", "Discounts", new { area = "Admin" }, FormMethod.Post, new { @class = "form-horizontal", @id = "formNew", @name = "formNew", enctype = "multipart/form-data" }))
       {%>
        <%: Html.ValidationSummary(true)%>
        
        <fieldset>
            <legend>Nhập đầy đủ thông tin</legend>

            <%:Html.HiddenFor(model =>model.ID) %>
            <%:Html.HiddenFor(model =>model.Delete) %>
            <div class="control-group">
                <div class="control-label">
                    <%: Html.LabelFor(model => model.TenChuongTrinh)%>
                </div>
                <div class="controls">
                    <%: Html.TextBoxFor(model => model.TenChuongTrinh, new { @id = "name" })%>
                    <span id="namenoti"></span>
                </div>
            </div>

            <div class="control-group">
                <div class="control-label">
                    <%: Html.LabelFor(model => model.GiamGia)%>
                </div>
                <div class="controls">
                    <%: Html.TextBoxFor(model => model.GiamGia, new { placeholder= "...%", @id= "number"})%>
                    <span id="numbernoti"></span>
                </div>
            </div>

            <div class="control-group">
                <div class="control-label">
                    <%: Html.LabelFor(model => model.NgayBatDau)%>
                </div>
                <div class="controls">
                    <%: Html.TextBoxFor(model => model.NgayBatDau, new { @id = "ngaybd", Value = Model.NgayBatDau, placeholder ="dd/MM/yyyy"})%>
                    <span id="ngaybdnoti"></span>
                </div>
            </div>

            <div class="control-group">
                <div class="control-label">
                    <%: Html.LabelFor(model => model.NgayKetThuc)%>
                </div>
                <div class="controls">
                    <%: Html.TextBoxFor(model => model.NgayKetThuc, new { @id = "ngaykt", Value = Model.NgayKetThuc, placeholder = "dd/MM/yyyy" })%>
                    <span id="ngayktnoti"></span>
                </div>
            </div>

            <div class="control-group">
                <div class="control-label">
                    <%: Html.LabelFor(model => model.MaLoaiLopHoc)%>
                </div>
                <div class="controls">
                    <%: Html.DropDownListFor(m => m.MaLoaiLopHoc, (SelectList)ViewData["loailophoc"])%>
                </div>
            </div>

<%--            <div class="control-group">
                <div class="control-label">
                    <%: Html.LabelFor(model => model.Deleted)%>
                </div>
                <div class="controls">
                    <%: Html.TextBoxFor(model => model.Deleted)%>
                    <%: Html.ValidationMessageFor(model => model.Deleted)%>
                </div>
            </div>--%>

            <div class="control-group">
                <div class="control-label"></div>
                <div class="controls">
                    <p>
                        <input type="submit" value="Save" class="btn btn-large btn-primary" onclick="javascript:return check_val();" />
                    </p>
                </div>
            </div>
        </fieldset>

    <% } %>

    </div>
</div>
<script type="text/javascript">
    function check_val() {
        var name = document.getElementById("name").value;
        var number = document.getElementById("number").value;
        var val = /[^a-zA-Z0-9]/;
        var valnum = /[^0-9]/;
        if (name == "") {
            document.getElementById("namenoti").innerHTML = "Không được để trống";
            return false;
        }
        if (name.match(val)) {
            document.getElementById("namenoti").innerHTML = "Đặt tên không hợp lệ";
            return false;
        }
        else
            document.getElementById("namenoti").innerHTML = "";
        if (number == "") {
            document.getElementById("numbernoti").innerHTML = "Không được để trống";
            return false;
        }
        if (number.match(valnum)) {
            document.getElementById("numbernoti").innerHTML = "Số liệu không hợp lệ";
            return false;
        }
        else
            document.getElementById("numbernoti").innerHTML = "";
        return true;
    }
</script>
</asp:Content>



<%--<%: Html.DropDownList("llhs", (SelectList)ViewData["loailophoc"], new{@id = "ddlllhs"})%>--%>